package com.xxxx.server.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxxx.server.mapper.PositionMapper;
import com.xxxx.server.pojo.Position;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.service.IPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoubin
 */
@Service
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements IPositionService {

    @Autowired
    private PositionMapper positionMapper;

    @Override
    public List<Position> selectPositionservice(String name) {
        List<Position> list=positionMapper.selectPositionDao(name);
        return list;
    }


    @Override
    public RespBean addPositionservice(Position positionvo) {

        Integer i=positionMapper.addPositionDao(positionvo);
        if (i==1){
            return RespBean.success("添加成功！",positionvo);
        }else {
           return RespBean.error("添加失败!",positionvo);
        }

    }

    @Override
    public RespBean updatePositionservice(Position positionvo) {

         Integer i= positionMapper.updatePositionDao(positionvo);
         if (i==1){

             return  RespBean.success("更新成功！",positionvo);
         }else {
             return RespBean.error("更新失败！",positionvo);
         }

    }

    @Override
    public RespBean deletPositionservice(String id) {
        Integer i=positionMapper.deletePositionDao(id);
        if (i==1){

            return  RespBean.success("更新成功！");
        }else {
            return RespBean.error("更新失败！");
        }
    }
}
